/*
 @判断是否相等
 @1.源单,2.选中,3(采购入库引用,销售出库引用)
*/
export  function equality(e1,e2,e3){
	var Good = e1;
	var data = e2;
	var batch = e3;
	var Obj = {
		status:false,
		index:-1,
	}
	console.log('执行了公共方法')
	console.log('源单数组')
	console.log(Good)
	console.log('选中的商品')
	console.log(data)
	for(var i in Good){
		// data["IsGift"] = data["IsGift"] == "0"?false:true;
		data["IsGift"] = data["IsGift"] == false || "0"?"0":"1";
		data["Qty"] = parseFloat(data["Qty"])
		// console.log('-------这是对比HOME----------------判断是否相等----');
		// console.log(Good[i]["GoodsID"] == data["GoodsID"],'这是商品ID', "选中" + Good[i]["GoodsID"], "源单" + data["GoodsID"]);
		// console.log(Good[i]["GoodsName"] == data["GoodsName"],'这是商品名称', "选中" + Good[i]["GoodsName"], "源单" + data["GoodsName"]);
		// console.log(Good[i]["UnitID"] == data["UnitID"],'这是单位', "选中" + Good[i]["UnitID"], "源单" + data["UnitID"]);
		// console.log(Good[i]["StoreID"] == data["StoreID"],'这是仓库', "选中" + Good[i]["StoreID"], "源单" + data["StoreID"]);
		// console.log(Good[i]["IsGift"]==  data["IsGift"],'这是赠品', "选中" + Good[i]["IsGift"], "源单" + data["IsGift"]);
		// console.log(this.isnulls(Good[i]["BatchNo"]) == this.isnulls(data["BatchNo"]),'这是批号', "选中" + this.isnulls(Good[i]["BatchNo"]), "源单" + this.isnulls(data["BatchNo"]))
		// console.log(parseFloat(Good[i]["Price"]) == parseFloat(data["Price"]),'这是单价', "选中" + parseFloat(Good[i]["Price"]), "源单" + parseFloat(data["Price"]));
		// console.log(Good[i]["Tax"] == data["Tax"], '这是税率', "选中" + Good[i]["Tax"], "源单" + data["Tax"]);
		// console.log(Good[i]["Discount"] == data["Discount"], '这是折扣', "选中" + Good[i]["Discount"], "源单" + data["Discount"]);
		// console.log(this.isnulls(this.timesubstr(Good[i]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"])),'这是生产日期', "选中" + this.isnulls(this.timesubstr(Good[i]["validityDate"])), "源单" + this.isnulls(this.timesubstr(data["validityDate"])))
		// console.log(this.isnulls(this.timesubstr(Good[i]["ProductionDate"])) ==this.isnulls(this.timesubstr(data["ProductionDate"])), '这是有效日期', "选中" + this.isnulls(this.timesubstr(Good[i]["ProductionDate"])), "源单" + this.isnulls(this.timesubstr(data["ProductionDate"])))
		if(Good[i]["GoodsName"] == data["GoodsName"] 
		   && Good[i]["GoodsID"] == data["GoodsID"] 
		   && Good[i]["StoreID"] == data["StoreID"]
		   && Good[i]["UnitID"] == data["UnitID"]
		   && Good[i]["IsGift"] == data["IsGift"]
		   // && this.isnulls(Good[i]["BatchNo"]) == this.isnulls(data["BatchNo"])
		   && parseFloat(Good[i]["Price"]) == parseFloat(data["Price"])
		   && Good[i]["Tax"] == data["Tax"]
		   && Good[i]["Discount"] == data["Discount"]
		   // && this.isnulls(this.timesubstr(Good[i]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
		   // && this.isnulls(this.timesubstr(Good[i]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))
			){
				if(batch == true){
					console.log('--------采购入库引用,销售出库引用--------相等---------------')
					Obj.status = true
					Obj.index = i
				}else{
					if(this.isnulls(Good[i]["BatchNo"]) == this.isnulls(data["BatchNo"])
					&& this.isnulls(this.timesubstr(Good[i]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
					&& this.isnulls(this.timesubstr(Good[i]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))){
						console.log('-------------------------相等---------------')
						Obj.status = true
						Obj.index = i
					}
				}
				// console.log('数量对比--------------------------------------------------------------------')
				// console.log('商品',Good[i]["Qty"])
				// console.log('源单',parseFloat(data["UNQTY"]))
				// if(parseFloat(Good[i]["Qty"]) >= parseFloat(data["Qty"])){
				// 	console.log('等于录-------------------------------------------')
				// 	status = 1;
				// 	break
					
				// }
		}
	}
	return Obj
	console.log('结果---------------------------------')
	console.log(Obj)
}
//源单商品与验单商品合并
export function source_Good(e1,e2,e3,e4){
	var Goodlist = e1;
	var sourceGood =e2;
	var batch = e3;
	var self = e4;
	// var Goodlist = this.OrderGoodsList;
	// var sourceGood = this.approvedlist
	console.log('合并')
	console.log(Goodlist)
	console.log(sourceGood)
	// return
	for(var i in Goodlist){
		var tmp = false
		var SourceBillType = '';
		var SourceDetailID = '';
		var SourceBillID = '';
		var hasqty = 0;
		var pr = 0; 
		for(var j in sourceGood){
			// Goodlist[i]["IsGift"] = Goodlist[i]["IsGift"] == "0"?false:true
			sourceGood[j]["IsGift"] = sourceGood[j]["IsGift"] == "0" || sourceGood[j]["IsGift"] == false?"0":"1"
			console.log('-------这是对比HOME----源单商品与验单商品合并----------')
			console.log('这是商品ID', "选中" + Goodlist[i]["GoodsID"], "源单" + sourceGood[j]["GoodsID"])
			// console.log('这是商品名称', "源单" + Goodlist[i]["GoodsName"], "选中" + sourceGood[j]["GoodsName"])
			console.log('这是单位', "选中" + Goodlist[i]["UnitID"], "源单" + sourceGood[j]["UnitID"])
			console.log('这是仓库', "选中" + Goodlist[i]["StoreID"], "源单" + sourceGood[j]["StoreID"])
			console.log('这是赠品', "选中" + Goodlist[i]["IsGift"], "源单" + sourceGood[j]["IsGift"])
			console.log('这是批号', "选中" + this.isnulls(Goodlist[i]["BatchNo"]), "源单" + this.isnulls(sourceGood[j]["BatchNo"]))
			console.log('这是单价', "选中" + parseFloat(Goodlist[i]["Price"]), "源单" + parseFloat(sourceGood[j]["Price"]))
			console.log('这是税率', "选中" + Goodlist[i]["Tax"], "源单" + sourceGood[j]["Tax"])
			console.log('这是折扣', "选中" + Goodlist[i]["Discount"], "源单" + sourceGood[j]["Discount"])
			console.log('这是生产日期', "选中" + this.isnulls(this.timesubstr(Goodlist[i]["validityDate"])), "源单" + this.isnulls(this.timesubstr(sourceGood[j]["validityDate"])))
			console.log('这是有效日期', "选中" + this.isnulls(this.timesubstr(Goodlist[i]["ProductionDate"])), "源单" + this.isnulls(this.timesubstr(sourceGood[j]["ProductionDate"])))
			console.log('-------这是对比END----------')
			if(Goodlist[i]["GoodsID"] == sourceGood[j]["GoodsID"]
			   && Goodlist[i]["UnitID"] == sourceGood[j]["UnitID"]
			   && Goodlist[i]["StoreID"] == sourceGood[j]["StoreID"]
			   && Goodlist[i]["IsGift"] == sourceGood[j]["IsGift"]
			   // && this.isnulls(Goodlist[i]["BatchNo"]) == this.isnulls(sourceGood[j]["BatchNo"])
			   && parseFloat(Goodlist[i]["Price"]) == parseFloat(sourceGood[j]["Price"])
			   && Goodlist[i]["Tax"] == sourceGood[j]["Tax"]
			   && Goodlist[i]["Discount"] == sourceGood[j]["Discount"]
			   // && this.isnulls(this.timesubstr(Goodlist[i]["validityDate"])) == this.isnulls(this.timesubstr(sourceGood[j]["validityDate"]))
			   // && this.isnulls(this.timesubstr(Goodlist[i]["ProductionDate"])) == this.isnulls(this.timesubstr(sourceGood[j]["ProductionDate"]))
			   // parseFloat(arrays[i]['Price']) == parseFloat(sourcedata[j]["Price"]) &&
			   // parseFloat(arrays[i]['Tax']) == parseFloat(sourcedata[j]["Tax"]) &&
			   // parseFloat(arrays[i]['Discount']) == parseFloat(sourcedata[j]["Discount"]) &&
			   // arrays[i]['validityDate'] == sourcedata[j]["validityDate"] &&
			   // arrays[i]['ProductionDate'] == sourcedata[j]["ProductionDate"]
			   ){
				if(batch ==true){
					tmp = true;
					console.log(sourceGood[j]["BillType"])
					console.log(sourceGood[j]["DetailID"])
					console.log(sourceGood[j]["BillID"])
					SourceBillType = sourceGood[j]["BillType"];
					SourceDetailID = sourceGood[j]["DetailID"];
					SourceBillID   = sourceGood[j]["BillID"];
					hasqty = Number(sourceGood[j]["UNQTY"]);
					console.log(sourceGood[j]["Price"])
					console.log('最近价格')
					pr = Number(sourceGood[j]["Price"]);
				}else{
					if(this.isnulls(Goodlist[i]["BatchNo"]) == this.isnulls(sourceGood[j]["BatchNo"])
					&& this.isnulls(this.timesubstr(Goodlist[i]["validityDate"])) == this.isnulls(this.timesubstr(sourceGood[j]["validityDate"]))
					&& this.isnulls(this.timesubstr(Goodlist[i]["ProductionDate"])) == this.isnulls(this.timesubstr(sourceGood[j]["ProductionDate"]))
					){
						tmp = true;
						console.log(sourceGood[j]["BillType"])
						console.log(sourceGood[j]["DetailID"])
						console.log(sourceGood[j]["BillID"])
						SourceBillType = sourceGood[j]["BillType"];
						SourceDetailID = sourceGood[j]["DetailID"];
						SourceBillID   = sourceGood[j]["BillID"];
						hasqty = Number(sourceGood[j]["Qty"]);
						console.log(sourceGood[j]["Price"])
						console.log('最近价格')
						pr = Number(sourceGood[j]["Price"]);
					}
				}
			}
		}
		if(tmp == true){
			Goodlist[i]["SourceBillType"] = SourceBillType;
			Goodlist[i]["SourceDetailID"] = SourceDetailID;
			Goodlist[i]["SourceBillID"] = SourceBillID;
			self.$set(Goodlist[i],'hasqty',hasqty);
			// this.$set(Goodlist[i],'Price',pr);
			if(this.isquote == 1){
				self.$set(Goodlist[i],'Price',pr);
			}
		}else{
			Goodlist[i]["SourceBillType"] = "0";
			Goodlist[i]["SourceDetailID"] = "0";
			Goodlist[i]["SourceBillID"] = "0";
			self.$set(Goodlist[i],'hasqty',0);
		}
	}
	console.log('执行了')
	console.log(Goodlist)
	return Goodlist;
}
//判断是否在单据里面  判断商品数量是否大于单据数量
			//判断录入数量是否大于源单数量
export	function Isbill(e1,e2,e3,e4){
				var result = {
					Isbills:0,
					Isgreater:0,
				}
				var tmpGoods = e1;
				var data = e2;
				var Good = e3;
				var batch = e4;
				// var tmpGoods = this.approvedlist
				console.log('数组对比');
				console.log(data);
				console.log(tmpGoods)
				
				for(var j in tmpGoods){
					    // data["IsGift"] = data["IsGift"] == "0"?false:true;
						tmpGoods[j]["IsGift"] = tmpGoods[j]["IsGift"] == false || "0"?"0":"1";
						tmpGoods[j]["Qty"] = parseFloat(tmpGoods[j]["Qty"])
					    console.log('-------这是对比HOME---------');
					    console.log('这是商品ID', "选中" + data["GoodsID"], "源单" + tmpGoods[j]["GoodsID"]);
					    console.log('这是商品名称', "选中" + data["GoodsName"], "源单" + tmpGoods[j]["GoodsName"]);
					    console.log('这是单位', "选中" + data["UnitID"], "源单" + tmpGoods[j]["UnitID"]);
					    console.log('这是仓库', "选中" + data["StoreID"], "源单" + tmpGoods[j]["StoreID"]);
					    console.log('这是赠品', "选中" + data["IsGift"], "源单" + tmpGoods[j]["IsGift"]);
					    console.log('这是批号', "选中" + this.isnulls(data["BatchNo"]), "源单" + this.isnulls(tmpGoods[j]["BatchNo"]))
					    console.log('这是单价', "选中" + parseFloat(data["Price"]), "源单" + parseFloat(tmpGoods[j]["Price"]));
					    console.log('这是税率', "选中" + data["Tax"], "源单" + tmpGoods[j]["Tax"]);
					    console.log('这是折扣', "选中" + data["Discount"], "源单" + tmpGoods[j]["Discount"]);
					    console.log('这是生产日期', "选中" + this.isnulls(this.timesubstr(data["validityDate"])), "源单" + this.isnulls(this.timesubstr(tmpGoods[j]["validityDate"])))
					    console.log('这是有效日期', "选中" + this.isnulls(this.timesubstr(data["ProductionDate"])), "源单" + this.isnulls(this.timesubstr(tmpGoods[j]["ProductionDate"])))
						if(tmpGoods[j]["GoodsName"] == data["GoodsName"] 
						   && tmpGoods[j]["GoodsID"] == data["GoodsID"] 
						   && tmpGoods[j]["StoreID"] == data["StoreID"]
						   && tmpGoods[j]["UnitID"] == data["UnitID"]
						   && tmpGoods[j]["IsGift"] == data["IsGift"]
						   // && this.isnulls(tmpGoods[j]["BatchNo"]) == this.isnulls(data["BatchNo"])
						   && parseFloat(tmpGoods[j]["Price"]) == parseFloat(data["Price"])
						   && tmpGoods[j]["Tax"] == data["Tax"]
						   && tmpGoods[j]["Discount"] == data["Discount"]
						   // && this.isnulls(this.timesubstr(tmpGoods[j]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
						   // && this.isnulls(this.timesubstr(tmpGoods[j]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))
							){
							//console.log('存在');
							//console.log(data["Qty"])
							//console.log(parseFloat(this.tmpGoods[i]["Qty"]))
							console.log('是源单商品')
							console.log('输入的数量')
							console.log(parseFloat(data["Qty"]))
							console.log('源单的数量')
							console.log(tmpGoods[j]["Qty"])
							if(batch){
								result.Isbills = 1;
								result.Isgreater = this.isgreater(tmpGoods[j],Good,batch)
							}else{
								if(this.isnulls(tmpGoods[j]["BatchNo"]) == this.isnulls(data["BatchNo"])
								&& this.isnulls(this.timesubstr(tmpGoods[j]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
								&& this.isnulls(this.timesubstr(tmpGoods[j]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))
								){
									result.Isbills = 1;
									result.Isgreater = this.isgreater(tmpGoods[j],Good,batch)
								}
							}
				}
				}
				return result
}
// 判断数量是否大于源单数量
export	function isgreater (e1,e2,e3) {
				// var Good = this.OrderGoodsList;//
				// var this = this;
				var data = e1;
				var Good = e2;
				var batch = e3;
				var status = 0;
				console.log('存在的商品')
				console.log(Good)
				console.log('源单的商品')
				console.log(data)
				if(batch){
					for(var i in Good){
						// data["IsGift"] = data["IsGift"] == "0"?false:true;
						data["IsGift"] = data["IsGift"] == false || "0"?"0":"1";
						data["Qty"] = parseFloat(data["Qty"])
						console.log('-------这是对比HOME---------');
						console.log('这是商品ID', "选中" + Good[i]["GoodsID"], "源单" + data["GoodsID"]);
						console.log('这是商品名称', "选中" + Good[i]["GoodsName"], "源单" + data["GoodsName"]);
						console.log('这是单位', "选中" + Good[i]["UnitID"], "源单" + data["UnitID"]);
						console.log('这是仓库', "选中" + Good[i]["StoreID"], "源单" + data["StoreID"]);
						console.log('这是赠品', "选中" + Good[i]["IsGift"], "源单" + data["IsGift"]);
						console.log('这是单价', "选中" + parseFloat(Good[i]["Price"]), "源单" + parseFloat(data["Price"]));
						console.log('这是税率', "选中" + Good[i]["Tax"], "源单" + data["Tax"]);
						console.log('这是折扣', "选中" + Good[i]["Discount"], "源单" + data["Discount"]);
						if(Good[i]["GoodsName"] == data["GoodsName"] 
						   && Good[i]["GoodsID"] == data["GoodsID"] 
						   && Good[i]["StoreID"] == data["StoreID"]
						   && Good[i]["UnitID"] == data["UnitID"]
						   && Good[i]["IsGift"] == data["IsGift"]
						   && parseFloat(Good[i]["Price"]) == parseFloat(data["Price"])
						   && Good[i]["Tax"] == data["Tax"]
						   && Good[i]["Discount"] == data["Discount"]
							){
								console.log('数量对比--------------------------------------------------------------------')
								console.log('商品',Good[i]["Qty"])
								console.log('源单',parseFloat(data["UNQTY"]))
								if(parseFloat(Good[i]["Qty"]) >= parseFloat(data["UNQTY"])){
									console.log('等于录-------------------------------------------')
									status = 1;
									break
								}
						}
					}
				}else{
					for(var i in Good){
						// data["IsGift"] = data["IsGift"] == "0"?false:true;
						data["IsGift"] = data["IsGift"] == false || "0"?"0":"1";
						data["Qty"] = parseFloat(data["Qty"])
						console.log('-------这是对比HOME---------');
						console.log('这是商品ID', "选中" + Good[i]["GoodsID"], "源单" + data["GoodsID"]);
						console.log('这是商品名称', "选中" + Good[i]["GoodsName"], "源单" + data["GoodsName"]);
						console.log('这是单位', "选中" + Good[i]["UnitID"], "源单" + data["UnitID"]);
						console.log('这是仓库', "选中" + Good[i]["StoreID"], "源单" + data["StoreID"]);
						console.log('这是赠品', "选中" + Good[i]["IsGift"], "源单" + data["IsGift"]);
						console.log('这是批号', "选中" + this.isnulls(Good[i]["BatchNo"]), "源单" + this.isnulls(data["BatchNo"]))
						console.log('这是单价', "选中" + parseFloat(Good[i]["Price"]), "源单" + parseFloat(data["Price"]));
						console.log('这是税率', "选中" + Good[i]["Tax"], "源单" + data["Tax"]);
						console.log('这是折扣', "选中" + Good[i]["Discount"], "源单" + data["Discount"]);
						console.log('这是生产日期', "选中" + this.isnulls(this.timesubstr(Good[i]["validityDate"])), "源单" + this.isnulls(this.timesubstr(data["validityDate"])))
						console.log('这是有效日期', "选中" + this.isnulls(this.timesubstr(Good[i]["ProductionDate"])), "源单" + this.isnulls(this.timesubstr(data["ProductionDate"])))
						if(Good[i]["GoodsName"] == data["GoodsName"] 
						   && Good[i]["GoodsID"] == data["GoodsID"] 
						   && Good[i]["StoreID"] == data["StoreID"]
						   && Good[i]["UnitID"] == data["UnitID"]
						   && Good[i]["IsGift"] == data["IsGift"]
						   && this.isnulls(Good[i]["BatchNo"]) == this.isnulls(data["BatchNo"])
						   && parseFloat(Good[i]["Price"]) == parseFloat(data["Price"])
						   && Good[i]["Tax"] == data["Tax"]
						   && Good[i]["Discount"] == data["Discount"]
						   && this.isnulls(this.timesubstr(Good[i]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
						   && this.isnulls(this.timesubstr(Good[i]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))
							){
								console.log('数量对比--------------------------------------------------------------------')
								console.log('商品',Good[i]["Qty"])
								console.log('源单',parseFloat(data["UNQTY"]))
								if(parseFloat(Good[i]["Qty"]) >= parseFloat(data["Qty"])){
									console.log('等于录-------------------------------------------')
									status = 1;
									break
								}
						}
					}
				}
				return status
}
//是否相等
export  function isequality(e1,e2,e3,e4){
	var Good = e1;//源单商品
	var data = e2;//添加的商品
	var batch = e3;//是否是引用销售订单,是否是引用采购订单
	var delivery = e4;//是否是配送出库单,配出退回单
	var status = false;
	console.log('执行了公共方法')
	console.log('源单数组')
	console.log(Good)
	console.log('选中的商品')
	console.log(data)
		// data["IsGift"] = data["IsGift"] == "0"?false:true;
		data["IsGift"] = data["IsGift"] == false || data["IsGift"] == "0"?"0":"1";
		// data["StoreID2"] = data["StoreID2"] == undefined || "0"?"":data["StoreID2"];
		// Good["StoreID2"] = Good["StoreID2"] == undefined || "0"?"":Good["StoreID2"];
		data["Qty"] = parseFloat(data["Qty"])
		console.log('-------这是对比HOME----------------判断是否相等----------------------');
		console.log(Good["GoodsID"] == data["GoodsID"],'这是商品ID', "选中" + Good["GoodsID"], "源单" + data["GoodsID"]);
		console.log(Good["GoodsName"] == data["GoodsName"],'这是商品名称', "选中" + Good["GoodsName"], "源单" + data["GoodsName"]);
		console.log(Good["UnitID"] == data["UnitID"],'这是单位', "选中" + Good["UnitID"], "源单" + data["UnitID"]);
		console.log(Good["StoreID"] == data["StoreID"],'这是仓库', "选中" + Good["StoreID"], "源单" + data["StoreID"]);
		console.log(Good["StoreID2"] == data["StoreID2"],'这是配入仓库', "选中" + Good["StoreID2"], "源单" + data["StoreID2"]);
		console.log(Good["IsGift"]==  data["IsGift"],'这是赠品', "选中" + Good["IsGift"], "源单" + data["IsGift"]);
		console.log(this.isnulls(Good["BatchNo"]) == this.isnulls(data["BatchNo"]),'这是批号', "选中" + this.isnulls(Good["BatchNo"]), "源单" + this.isnulls(data["BatchNo"]))
		console.log(parseFloat(Good["Price"]) == parseFloat(data["Price"]),'这是单价', "选中" + parseFloat(Good["Price"]), "源单" + parseFloat(data["Price"]));
		console.log(Good["Tax"] == data["Tax"], '这是税率', "选中" + Good["Tax"], "源单" + data["Tax"]);
		console.log(Good["Discount"] == data["Discount"], '这是折扣', "选中" + Good["Discount"], "源单" + data["Discount"]);
		console.log(this.isnulls(this.timesubstr(Good["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"])),'这是生产日期', "选中" + this.isnulls(this.timesubstr(Good["validityDate"])), "源单" + this.isnulls(this.timesubstr(data["validityDate"])))
		console.log(this.isnulls(this.timesubstr(Good["ProductionDate"])) ==this.isnulls(this.timesubstr(data["ProductionDate"])), '这是有效日期', "选中" + this.isnulls(this.timesubstr(Good["ProductionDate"])), "源单" + this.isnulls(this.timesubstr(data["ProductionDate"])))
		if(Good["GoodsName"] == data["GoodsName"] 
		   && Good["GoodsID"] == data["GoodsID"] 
		   && Good["StoreID"] == data["StoreID"]
		   // && Good["StoreID2"] == data["StoreID2"]
		   && Good["UnitID"] == data["UnitID"]
		   && Good["IsGift"] == data["IsGift"]
		   // && this.isnulls(Good[i]["BatchNo"]) == this.isnulls(data["BatchNo"])
		   && parseFloat(Good["Price"]) == parseFloat(data["Price"])
		   && Good["Tax"] == data["Tax"]
		   && Good["Discount"] == data["Discount"]
		   // && this.isnulls(this.timesubstr(Good[i]["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
		   // && this.isnulls(this.timesubstr(Good[i]["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))
			){
				if(batch == true){
					console.log('--------采购入库引用,销售出库引用--------相等---------------')
					status = true
				}else{
					if(this.isnulls(Good["BatchNo"]) == this.isnulls(data["BatchNo"])
					&& this.isnulls(this.timesubstr(Good["ProductionDate"])) == this.isnulls(this.timesubstr(data["ProductionDate"]))
					&& this.isnulls(this.timesubstr(Good["validityDate"])) == this.isnulls(this.timesubstr(data["validityDate"]))){
						console.log('-------------------------相等---------------')
						if(delivery == true){
							if(Good["StoreID2"] == data["StoreID2"]){
								console.log('------------------配送订单------相等-------------')
								status = true
							}
						}else{
							console.log('---------普通订单-------相等-----------')
							status = true
						}
					}
				}
		}
	
   return status
}
export function isidentical(Good,Sood,delivery){
				var status = false
				console.log('源单商品合并==================================')
				// console.log(Good["BarCode"] == Sood["BarCode"],'条码','源单'+Good["BarCode"],'选中的商品'+Sood["BarCode"])
				console.log(Good["GoodsID"] == Sood["GoodsID"],'商品','源单'+Good["GoodsID"],'选中的商品'+Sood["GoodsID"])
				console.log(Good["StoreID"] == Sood["StoreID"],'仓库','源单'+Good["StoreID"],'选中的商品'+Sood["StoreID"])
				console.log(Good["UnitID"] == Sood["UnitID"],'单位','源单'+Good["UnitID"],'选中的商品'+Sood["UnitID"])
				console.log(Good["IsGift"] == Sood["IsGift"],'赠品','源单'+Good["IsGift"],'选中的商品'+Sood["IsGift"])
				if(
				// Good["BarCode"] == Sood["BarCode"]
				Good["GoodsID"] == Sood["GoodsID"]
				&& Good["StoreID"] == Sood["StoreID"]
				&& Good["UnitID"] == Sood["UnitID"]
				// && Good["IsGift"] == Sood["IsGift"]
				){
					if(delivery){
						if(Good["StoreID2"] == Sood["StoreID2"]){
						status = true	
						}
					}else{
						status = true
					}
				}
				return status
			}
//存在undefined就转为空!
export function isnulls(e){
	return e == "" || typeof e == 'undefined' ?"":e;
}
// 日期截取
export function timesubstr(e){
	return e == ""|| e == undefined ? e : e.substring(0,10);
}